import { createRouter, createWebHashHistory, RouteLocationNormalized, RouteRecordRaw, } from 'vue-router'
import Aachievement from '../admin/views/Activity/achievement.vue'
import Activity1 from '../admin/views/Activity/activity.vue'
import AIActivitySummarize from '../admin/views/Activity/aIActivitySummarize.vue'
import customerservice from '../admin/views/Activity/customerservice.vue'
import Duplicate from '../admin/views/Activity/duplicate.vue'
import Activity from '../admin/views/Activity/index.vue'
import MatchLabel from '../admin/views/Activity/matchLabel.vue'
import { default as ActivityQuestionVue, default as Aquestion } from '../admin/views/Activity/question.vue'
import Asignup from '../admin/views/Activity/signup.vue'
import SmsAVue from '../admin/views/Activity/sms.vue'
import AddActivity from '../admin/views/Activity/updateActivity.vue'
import WatchActivityQuestionVue from '../admin/views/Activity/WatchActivityQuestion.vue'
import ApitestVue from '../admin/views/apitest/index.vue'
import Article from '../admin/views/Article/index.vue'
import catebag from '../admin/views/course/catebagindex.vue'
import catebags from '../admin/views/course/catebags.vue'
import course from '../admin/views/course/courseindex.vue'
import courses from '../admin/views/course/courses.vue'
import coursesections from '../admin/views/course/coursesections.vue'
import lessions from '../admin/views/course/lessions.vue'
import watchcourse from '../admin/views/course/watchcourse.vue'
import Examinecourseforum from '../admin/views/examine/courseforum.vue'
import Examine from '../admin/views/examine/index.vue'
import Examinematchcomment from '../admin/views/examine/matchcomment.vue'
import Examinequestioncomment from '../admin/views/examine/questioncomment.vue'
import Examinesolution from '../admin/views/examine/solution.vue'
import Iintegralreward from '../admin/views/integral/Iintegralreward.vue'
import integralVue from '../admin/views/integral/index.vue'
import integralListVue from '../admin/views/integral/indexlist.vue'
import Iintegralrewarduser from '../admin/views/integral/integralrewarduser.vue'
import Label from '../admin/views/Label.vue'
import Applogs from '../admin/views/logs/index.vue'
import Notice from '../admin/views/notice/index.vue'
import Acc from '../admin/views/Question/acc.vue'
import AISolution from '../admin/views/Question/AISolution.vue'
import batchquestion from '../admin/views/Question/batch.vue'
import question from '../admin/views/Question/index.vue'
import questioninfo from '../admin/views/Question/questioninfo.vue'
import Testcase from '../admin/views/Question/testcase.vue'
import updatequestion from '../admin/views/Question/update.vue'
import usertestcase from '../admin/views/Question/usertestcase.vue'
import watchusertestcase from '../admin/views/Question/watchusertestcase.vue'
import addquestionbank from '../admin/views/Questionbank/addquestionbank.vue'
import questionbankindex from '../admin/views/Questionbank/index.vue'
import Setup from '../admin/views/Setup.vue'
import signinactivityindex from '../admin/views/signinactivity/index.vue'
import signinactivity from '../admin/views/signinactivity/signinactivity.vue'
import signinactivityuser from '../admin/views/signinactivity/user.vue'
import SmsAll from '../admin/views/sms/index.vue'
import spj from '../admin/views/spj/index.vue'
import spjupdate from '../admin/views/spj/update.vue'
import StatisticsVue from '../admin/views/Statistics/index.vue'
import StatisticscharVue from '../admin/views/Statistics/statischar.vue'
import AddTeamjob from '../admin/views/Team/addteamjob.vue'
import teamfile from '../admin/views/Team/file.vue'
import Team from '../admin/views/Team/index.vue'
import TeamNotice from '../admin/views/Team/notice.vue'
import TeamSms from '../admin/views/Team/sms.vue'
import Teamhome from '../admin/views/Team/teamhome.vue'
import Teamid from '../admin/views/Team/teamid.vue'
import Teamjob from '../admin/views/Team/teamjob.vue'
import Teampackegekey from '../admin/views/Team/teampackegekey.vue'
import Teamquetion from '../admin/views/Team/teamquestion.vue'
import Teamquestionbank from '../admin/views/Team/teamquestionbank.vue'
import Teamuser from '../admin/views/Team/teamuser.vue'
import Teamusergroup from '../admin/views/Team/teamusergroup.vue'
import Teamwork from '../admin/views/Team/teamwork.vue'
import UserWeeklySummary from '../admin/views/Team/userWeeklySummary.vue'
import device from '../admin/views/tuyaiot/device.vue'
import tuyaiot from '../admin/views/tuyaiot/index.vue'
import User from '../admin/views/User/index.vue'
import UserQuestion from '../admin/views/userquestion/indexAdmin.vue'
import UserQuestionbank from '../admin/views/userquestion/UserQuestionbank.vue'
import uservip from '../admin/views/vip/index.vue'
import zhimahuuser from '../admin/views/zhimahuuser/index.vue'
import Home from './views/Home.vue'
import Login from './views/Login.vue'
function toID(rote: RouteLocationNormalized): Record<string, any> {
  return {
    ID: Number(rote.params.ID)
  }
}

const routes: RouteRecordRaw[] = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    children: [
      {
        path: 'customerservice',
        name: '助教老师',
        component: customerservice
      },
      {
        path: 'tuyaiot',
        name: '涂鸦iot',
        component: tuyaiot
      },
      {
        path: 'tuyaiot/:ID',
        name: 'device',
        component: device,
        props: toID
      },
      {
        path: 'SmsAll',
        name: '所有短信',
        component: SmsAll
      },
      {
        path: 'statisticschar',
        name: '数据图表',
        component: StatisticscharVue
      },
      {
        path: 'statistics',
        name: '数据统计',
        component: StatisticsVue
      },
      {
        path: 'integral',
        name: '积分记录',
        component: integralVue
      },
      {
        path: 'integrallist',
        name: '积分列表',
        component: integralListVue
      },
      {
        path: 'Iintegralreward',
        name: '积分兑换',
        component: Iintegralreward
      },
      {
        path: 'Iintegralrewarduser/:ID',
        name: '金币兑换人',
        component: Iintegralrewarduser,
        props: toID,

      },
      {
        path: 'signinactivity',
        name: '活动签到',
        component: signinactivity
      },
      {
        path: 'signinactivity/:ID',
        name: '活动签到首页',
        component: signinactivityindex,
        props: toID,
        children: [
          {
            path: 'user',
            name: '活动签到用户',
            component: signinactivityuser
          },
        ]
      },
      {
        path: 'question',
        name: '题目管理',
        component: question,
      },
      {
        path: 'batchquestion',
        name: '批量导入题目',
        component: batchquestion,
      },
      {
        path: 'question/:ID',
        name: '题目',
        component: questioninfo,
        props: toID,
        children: [

          {
            path: 'testcase',
            name: '测试点',
            component: Testcase
          },
          {
            path: 'acc',
            name: '题解',
            component: Acc
          },
        ]
      },
      {
        path: 'AISolution',
        name: '题目题解(AI)',
        component: AISolution,

      },
      {
        path: 'examine',
        name: '内容审核',
        component: Examine,
        redirect: {
          name: '题目讨论'
        },
        children: [
          {
            path: 'Examinequestioncomment',
            name: '题目讨论',
            component: Examinequestioncomment
          },
          {
            path: 'Examinecourseforum',
            name: '视频讨论',
            component: Examinecourseforum
          },
          {
            path: 'Examinematchcomment',
            name: '比赛讨论',
            component: Examinematchcomment
          },
          {
            path: 'Examinesolution',
            name: '题解审核',
            component: Examinesolution
          },
          {
            path: 'usertestcase',
            name: '测试点审核',
            component: usertestcase
          },
        ]
      },
      {
        path: 'usertestcase/:ID',
        name: '查看用户测试点',
        component: watchusertestcase,
        props: toID
      },
      {
        path: 'updataquestion',
        name: '更新题目',
        component: updatequestion,
      },
      {
        path: 'activity',
        name: '比赛管理',
        component: Activity,
      },
      {
        path: 'addactivity',
        name: '添加比赛',
        component: AddActivity,
      },
      {
        path: 'matchLabel',
        name: '类别配置',
        component: MatchLabel,
      },
      {
        path: 'activity/:ID',
        name: '查看比赛',
        component: Activity1,
        props: toID,
        children: [
          {
            path: 'Asignup',
            name: '报名用户',
            component: Asignup
          },
          {
            path: 'ActivityQuestionVue',
            name: '比赛题目',
            component: ActivityQuestionVue
          },
          {
            path: 'watchActivityQuestionVue/',
            name: '查看比赛题目',
            component: WatchActivityQuestionVue,
          },
          {
            path: 'Aachievement',
            name: '比赛成绩',
            component: Aachievement
          },
          {
            path: 'Aquestion',
            name: '比赛题目',
            component: Aquestion
          },
          {
            path: 'ASms',
            name: '比赛短信发送',
            component: SmsAVue
          },
          {
            path: 'Duplicate',
            name: '比赛其他功能',
            component: Duplicate
          },
          {
            path: 'AIActivitySummarize',
            name: 'AI分析比赛',
            component: AIActivitySummarize
          },
        ]
      },
      {
        path: 'article',
        name: '文章管理',
        component: Article,
      },
      {
        path: 'user',
        name: '用户管理',
        component: User,
      },
      {
        path: 'uservip',
        name: '用户vip',
        component: uservip,
      },
      {
        path: 'zhimahuuser',
        name: '知码狐用户',
        component: zhimahuuser,

      },
      // {
      //   path: 'user/:id',
      //   name: '用户信息',
      //   component: Userinfo,
      //   children: [
      //     {
      //       path: 'usercourse',
      //       name: '用户课程',
      //       component: usercourse
      //     },
      //   ]
      // },
      {
        path: 'label',
        name: '标签管理',
        component: Label,
      },
      {
        path: 'teams',
        name: '团队管理',
        component: Team,
      },
      {
        path: 'team/:ID?',
        name: '团队',
        component: Teamid,
        props: toID,
        redirect: to => {
          return { name: '团队人员' }
        },
        children: [
          {
            path: 'teamuser',
            name: '团队人员',
            component: Teamuser,
          },
          {
            path: 'teamquestionbank',
            name: '团队题单',
            component: Teamquestionbank,
          },
          {
            path: 'teamquestion',
            name: '团队题库',
            component: Teamquetion,
          },
          {
            path: 'teamusergroup',
            name: '团队用户组',
            component: Teamusergroup,
          },
          {
            path: 'teamwork',
            name: '团队作业',
            component: Teamwork,
          },
          {
            path: 'teampackegekey',
            name: '团队课程包',
            component: Teampackegekey,
          },
          {
            path: 'notice',
            name: '团队通知',
            component: TeamNotice,
          },
          {
            path: 'sms',
            name: '团队短信',
            component: TeamSms,
          },
          {
            path: 'teamfile',
            name: '团队文件',
            component: teamfile,
          },
          {
            path: 'teamhome',
            name: '团队地址',
            component: Teamhome,
          },
          {
            path: 'userWeeklySummary',
            name: '成员周数据',
            component: UserWeeklySummary,
          },
          {
            path: 'teamjob',
            name: '团队工作',
            component: Teamjob,
          },
          {
            path: 'addteamjob',
            name: '创建工作',
            component: AddTeamjob,
          },
        ]
      },

      {
        path: 'questionbank',
        name: '题单管理',
        component: questionbankindex,
      },
      // {
      //   path: 'questionbank/:ID',
      //   name: '题单',
      //   component: questionbank,
      //   props: toID
      // },
      {
        path: 'addquestionbank',
        name: '添加题单',
        component: addquestionbank,
      },
      {
        path: 'setup',
        name: '网站设置',
        component: Setup,
      },
      {
        path: 'apitest',
        name: '接口测试',
        component: ApitestVue,
      },
      {
        path: 'notice',
        name: '通知',
        component: Notice
      },
      {
        path: 'userquestion',
        name: '答题记录',
        component: UserQuestion
      },
      {
        path: 'userquestionbank',
        name: '题单记录',
        component: UserQuestionbank
      },
      {
        path: 'logs',
        name: '行为日志',
        component: Applogs
      },
      {
        name: '结果测试',
        path: 'spj',
        component: spj,
      },
      {
        name: '更新结果测过',
        path: 'updatespj',
        component: spjupdate
      },
      {
        name: '课程管理',
        path: 'courses',
        component: courses,
      },
      {
        name: '课程',
        path: 'course/:ID',
        component: course,
        props: toID,
        redirect: to => {
          return { name: '查看课程' }
        },
        children: [
          {
            name: '查看课程',
            path: 'watchcourse',
            component: watchcourse,
          },
          {
            name: '课程小节s',
            path: 'lessions',
            component: lessions,
          }
        ]
      },
      {
        name: '课程小节管理',
        path: 'coursesections',
        component: coursesections,
        props: toID,
      },
      {
        name: '课程组管理',
        path: 'catebags',
        component: catebags,
      },
      {
        name: '课程组',
        path: 'catebag/:ID',
        component: catebag,
        props: toID,
      },
    ]
  },
  {
    path: '/Login',
    name: 'Login',
    component: Login
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
